#include ".\gameclient.h"
#include "HallMsg.h"

IGameClient::IGameClient(IGameRoom *room)
{
    _DEBUG_CHECK(room);

    m_Table = NULL;
    m_Self = NULL;
    m_pRoom = room;
}

IGameClient::~IGameClient(void)
{
}

MONEY_ID IGameClient::getGameMoney(IPlayer *player)
{
    if (IS_MONEY_GAME(getGameInfo()))
        return player->getMoney();
    else if (IS_SCORE_GAME(getGameInfo()))
        return player->getScore();
    else
        return 0;
}

bool IGameClient::sendNetPacket(const void *data,size_t size)
{
    _DEBUG_CHECK(m_pStation);
    return m_pStation->SendData(data,size);
}

void IGameClient::questLeaveTable()
{
    assert(m_Self);
    NetPacket<sPlayerLeaveTable> leave(ePF_SYSTEM,eMSID_USERLEAVE_TABLE);
    leave.data.seat = m_Self->getSeat();
    leave.data.table = m_Self->getTable()->GetPlayerSeat( m_Self );
    leave.data.user = m_Self->getUID();
    m_pStation->SendData(&leave,sizeof(leave));
}